package com.myself.springboot.springboot_study.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.server.WebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyserveConfiger{

    String port;
    // 通过实现WebServerFactoryCustomizer的子类ConfigurableServletWebServerFactory来配置嵌入式servelet容器的一些基本配置
    // 并通过@Bean注册成组件交给spring容器管理
//    @Bean
//    public WebServerFactoryCustomizer myWebServerFactoryCustomizer() {
//        return new WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>(){
//            @Override
//            public void customize(ConfigurableServletWebServerFactory factory) {
//                System.out.println(port + "============================================================ssss");
//                factory.setPort(9000);
//                factory.setContextPath("/aabb");
//            }
//        };
//    }
}
